package com.mz.mattress.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mz.mattress.admin.api.req.MemberBalanceRecordQueryReq;
import com.mz.mattress.admin.mapper.MemberBalanceRecordMapper;
import com.mz.mattress.admin.service.MemberBalanceRecordService;
import com.mz.mattress.api.common.Result;
import com.mz.mattress.api.entity.MemberBalanceRecord;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class MemberBalanceRecordServiceImpl implements MemberBalanceRecordService {

    @Autowired
    private MemberBalanceRecordMapper memberBalanceRecordMapper;

    @Override
    public Result<IPage<MemberBalanceRecord>> listPage(MemberBalanceRecordQueryReq req) {

        Page<MemberBalanceRecord> list =
                memberBalanceRecordMapper.listPage(req.newPage(), req.getMemberId(), req.getStartTime(), req.getEndTime());

        return Result.ok(list);
    }
}
